// hyb_yl/mysubpages/pages/unscramble/unscramble.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentData: 0,
    tab: [{
        name: "全部"
      },
      {
        name: "待支付"
      },
      {
        name: "待解读"
      },
      {
        name: "已完成"
      },
    ], //选项卡
    current: 0,
    //states 0 检验报告  1  基因报告  2  体检报告
    orderlist: [],
    sicklist: [
      // {
      //   headimg: "../../../images/xzadd.png",
      //   names: "张三",
      //   sex: "男",
      //   age: "23",
      //   times: "2019年12月8日",
      //   hospital: "山西省白求恩医院",
      //   numbers: "8529638525623",
      //   states: 0,
      //   status:1,
      // }, {
      //   headimg: "../../../images/xzadd.png",
      //   names: "张三",
      //   sex: "男",
      //   age: "23",
      //   times: "2019年12月8日",
      //   hospital: "山西省白求恩医院",
      //   numbers: "8529638525623",
      //   states: 1,
      //   status: 2,
      // }, {
      //   headimg: "../../../images/xzadd.png",
      //   names: "张三",
      //   sex: "男",
      //   age: "23",
      //   times: "2019年12月8日",
      //   hospital: "山西省白求恩医院",
      //   numbers: "8529638525623",
      //   states: 2,
      //   status: 3,
      // },
    ],
  },
  //查看报告
  lookreport(e) {
    let status = e.currentTarget.dataset.status
    if (status == 1) {
      wx.navigateTo({
        url: '/hyb_yl/mysubpages/pages/report_detail/report_detail',
      })
    } else {
      wx.navigateTo({
        url: '/hyb_yl/mysubpages/pages/diagReport/diagReport',
      })
    }
  },
  // 切换
  chooseTab: function (e) {
    let t = this,
      i = e.target.dataset.i;
    t.setData({
      current: i,
      currentData: i
    })
    console.log(i)
    t.getAlljieduorder(i)

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    this.setData({
      orderlist: this.data.sicklist
    })
    that.getAlljieduorder()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  getAlljieduorder(index) {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/user.alljiedu',
      data: {
        openid: wx.getStorageSync('openid'),
        index: index
      },
      success: function (res) {
        console.log(res)
        that.setData({
          unscramble: res.data
        })
      }
    })
  },
  reportDetailClick(e) {
    var that = this
    var list = e.currentTarget.dataset
    var orders = e.currentTarget.dataset.orders
    var j_id = e.currentTarget.dataset.j_id
    var key_words = that.data.key_words
    var zid = e.currentTarget.dataset.zid
    var ifpay = e.currentTarget.dataset.ifpay
    var money = e.currentTarget.dataset.money
    var overtime = e.currentTarget.dataset.overtime
    var id = e.currentTarget.dataset.id
    var currentData = that.data.currentData
    var ifgb = e.currentTarget.dataset.ifgb
    wx.navigateTo({
      url: '/hyb_yl/zhuanjiasubpages/pages/zhifuend/zhifuend?id=' + id + '&txt=yes' + '&zid=' + zid + '&back_orser=' + orders + '&key_words=tijianjiedu' + '&j_id=' + j_id + '&ifpay=' + ifpay + '&money=' + money + '&overtime=' + overtime + '&currentData=' + currentData + '&ifgb=' + ifgb,
    })
  }
})